//package com.vast.admin.controller;
//
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.vast.admin.annotation.CurrentManager;
//import com.vast.admin.annotation.UseToken;
//import com.vast.common.core.domain.entity.SysRole;
//import com.vast.admin.entity.enums.QueryOrderEnum;
//import com.vast.admin.service.RoleMenuService;
//import com.vast.common.annotation.Log;
//import com.vast.common.core.domain.AjaxResult;
//import com.vast.common.core.domain.entity.SysUser;
//import com.vast.common.constant.MessageCode;
//import com.vast.common.core.domain.Result;
//import com.vast.system.core.controller.BaseController;
//import com.vast.system.service.ISysRoleService;
//import io.swagger.annotations.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
///**
// * <p>
// * 管理员 前端控制器
// * </p>
// *
// * @author zhaohao
// * @since 2019-10-30
// */
//@RestController
//@Api(value = "角色管理相关接口", tags = { "角色管理模块" })
//@RequestMapping("/manager/role")
//public class RoleController  extends BaseController {
//
//
//	@Autowired
//	private ISysRoleService roleService;
//
//	@Autowired
//	private RoleMenuService roleMenuService;
//
//
//	@ApiOperation(value = "查询列表信息", notes = "通过条件查询列表")
//	@ApiImplicitParams({
//			@ApiImplicitParam(paramType = "query", name = "size", value = "分页条数", dataType = "int", defaultValue = "10", required = false),
//			@ApiImplicitParam(paramType = "query", name = "current", value = "页码,起始值:1", dataType = "int", defaultValue = "1", required = false),
//			@ApiImplicitParam(paramType = "query", name = "listMode", value = "是否集合模式:true不进行分页直接返回所有结果集", dataType = "boolean", defaultValue = "false", required = false),
//			@ApiImplicitParam(paramType = "query", name = "queryItems", value = "查询条件,json集合", defaultValue = "account,EQ,13419519796;", dataType = "String", required = false),
//			@ApiImplicitParam(paramType = "query", name = "orderField", value = "排序字段,多个','分隔", defaultValue = "create_time", dataType = "String",  required = false),
//			@ApiImplicitParam(paramType = "query", name = "order", value = "排序类型: ASC/DESC", dataType = "QueryOrderEnum",  required = false)
//			})
//	@GetMapping("/page")
////	@Log(title = "查询角色列表")
//	public Result<IPage<SysRole>> page(@ApiParam(hidden = true) Page<SysRole> page, boolean listMode, String queryItems, String orderField, QueryOrderEnum order) {
//		return new Result<IPage<SysRole>>(MessageCode.SUCCESS, "获取成功", roleService.queryList(page, listMode, queryItems, orderField,order));
//
//	}
//
//	@ApiOperation(value = "添加角色和对应菜单", notes = "添加角色和对应菜单")
//	@UseToken
//	@PostMapping("/addOrUpdate")
//	@Log(title = "添加或更新角色和对应菜单")
//	public Result<SysRole> addOrUpdate(@ApiParam(hidden = true)@CurrentManager SysUser manager, @RequestBody @ApiParam(name="SysRole",value="Role信息",required=true) SysRole role) {
//		if(role != null) {
//			boolean flag  = roleService.addOrUpdate(manager, role);
//			if(flag){
//				return new Result<SysRole>(MessageCode.SUCCESS, "成功", role);
//			}else{
//				return new Result<SysRole>(MessageCode.ERROR, "失败");
//			}
//		}else {
//			return new Result<SysRole>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//	@ApiOperation(value = "通过id获取信息", notes = "通过id获取信息")
//	@ApiImplicitParams({
//			@ApiImplicitParam(paramType = "header", name = "token", value = "登录获取的token", dataType = "String", required = true)})
//	@GetMapping("/info/{id}")
//	@UseToken
//	@Log(title = "通过id获取角色信息")
//	public Result<SysRole> info(@ApiParam(hidden = true) @CurrentManager SysUser manager,@PathVariable("id") Long id) {
//		if(id != null && id.longValue() > 0){
//			SysRole role = roleService.info(manager,id);
//			if(role != null){
//				return new Result<SysRole>(MessageCode.SUCCESS, "获取成功", role);
//			}else{
//				return new Result<SysRole>(MessageCode.ERROR, "获取失败");
//			}
//		}
//		return new Result<SysRole>(MessageCode.PARAM_ERROR, "id不能为空");
//	}
//
//	@ApiOperation(value = "删除角色", notes = "删除角色")
//	@UseToken
//	@Log(title = "删除角色")
//	@DeleteMapping("/delete")
//	public Result<Boolean> delete(@ApiParam(hidden = true)@CurrentManager SysUser manager, @RequestBody @ApiParam(name="ids",value="数据id数组,以','分隔",required=true) Long[] ids) {
//		if(ids != null) {
//			boolean flag  = roleService.delete(manager, ids);
//			if(flag){
//				return new Result<Boolean>(MessageCode.SUCCESS, "删除成功");
//			}else{
//				return new Result<Boolean>(MessageCode.ERROR, "删除失败");
//			}
//		}else {
//			return new Result<Boolean>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//
//	@GetMapping("/list")
//	public Result<IPage<SysRole>> list(@ApiParam(hidden = true) Page<SysRole> page, SysRole role)
//	{
//		IPage<SysRole> list = roleService.selectRoleList(page,role);
//		return new Result<IPage<SysRole>>(MessageCode.SUCCESS, "获取成功",list);
//	}
//
//
//	/**
//	 * 修改保存数据权限
//	 */
//	@PostMapping("/dataScope")
//	public AjaxResult dataScope(@RequestBody SysRole role)
//	{
//		roleService.checkRoleAllowed(role);
//		return toAjax(roleService.authDataScope(role));
//	}
//
//
//	/**
//	 * 删除角色
//	 */
//	@DeleteMapping("/{roleIds}")
//	public AjaxResult remove(@ApiParam(hidden = true)@CurrentManager SysUser manager, @PathVariable Long[] roleIds)
//	{
//
//		return toAjax(roleService.delete(manager,roleIds)==true?roleIds.length:0);
//	}
//
//}
